I got this e-mail from Bill Huber warning me about the avenue scripts I sent out. If you will be using the same scripts, please read the warning below. Thanks, Christie Kearney >Davoust) >... >for each elt in the_views > elt.AddTheme(the_theme) >end > >(Jorquera) ... > aDoc.AddTheme(aTheme) It is very important to know that these scripts contain a common nasty bug: because the same theme is added to all views, any changes to the theme in one view will occur in the versions of that theme shown in all the other views: changing the legend, selecting features, open the table, turning the theme on or off, etc. This sounds like a nice feature, and it could be, except it violates the Avenue object model (themes are supposed to be associated with a unique view: see the Avenue help on "GetView"), which seems eventually to lead to unstable ArcView behavior, segmentation violations, and so on. ***You could lose your project when this happens.*** If you have used either of these scripts, I strongly recommend reverting to a copy of your project as it existed before you ran them. The fix is to clone a theme before adding it to any other view. Please consider posting this information on ArcView-L as a supplement to your summary. And, as always on the Internet, caveat lector. Best regards, Bill Huber -----Original Message----- From: Kearney, Christie [mailto:Ckearney@HDRINC.COM] Sent: Tuesday, June 05, 2001 4:52 PM To: ARCVIEW-L@ESRI.COM Subject: [ARCVIEW-L] SUM: ARCVIEW-L] Copying a shapefile into numerous views Thanks to everyone who replied (Bill Huber, Lionel Davoust, Lorenzo Jorquera, Tara Montgomery, Scott Webb, and anyone I am forgetting). Every volunteered script for me to use. Here is the original question: Hello, I was wondering if there is a way to add a shapefile to numerous views without going into all the views individually. I have ~60+ views I want it added to, but can't find a good way to do it without opening each (which takes forever!). Script (Huber): ------------------ Add the shapefile(s) to one view as a theme. Edit its (their) properties and legend(s). Activate it (or them). Then run this script: ' ' Add copies of all active themes to all views. ' theView = av.GetActiveDoc lThemes = theView.GetActiveThemes for each v in av.GetProject.GetDocs if (v.Is(View).Not) then continue end if (v = theView) then continue end for each t in lThemes v.AddTheme(t.Clone) end end ' end of script If you don't want to add the shapefile to every view, you have to work a little harder: somehow you have to identify which views are the desired ones. There are many, many ways to do that (such as: pick from a list, use only the open ones, use only those with a common GUI, use object tags, use a view naming convention, ask a yes/no question for each view, predefine them within a list in the script, create a table of the desired views, etc., etc.); pick your favorite and hack the script. (Davoust) ------------ A bit of Avenue coding should do the trick. For example, you can make the theme out of the shapefile: the_theme = Theme.Make("c:/yourtheme.shp") Then add it to each view: the_views = av.GetProject.GetDocs.FindByClass(View) for each elt in the_views elt.AddTheme(the_theme) end (Jorquera) ------------- You can use an avenue script like this: aTheme = Theme.Make(src.AsSrcName) FOR EACH aDoc IN av.GetProject.GetDocs IF (aDoc.Is(View) ) THEN aDoc.AddTheme(aTheme) END END where src must be path to the source of your theme (the shapefile). If you want the new theme to be visible and active yo should add these lines: aTheme.SetVisible(TRUE) aTheme.SetActive(TRUE) ---------------------------------- There were many others, but I got what I needed. Thanks again! Christie Kearney